"""fangtx URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.urls import path
from rest_framework.routers import DefaultRouter

from api.views import send_code_by_sms, ProvinceView, DistrictView, HotCityView, HouseTypeViewSet, AgentViewSet, \
    EstateViewSet, HouseInfoViewSet, TagViewSet, UserViewSet, login

urlpatterns = [
    path('token/', login),
    path('mobile_code/<str:tel>/', send_code_by_sms),
    path('districts/', ProvinceView.as_view()),
    path('districts/<int:pk>/', DistrictView.as_view()),
    path('hotcities/', HotCityView.as_view()),
]

router = DefaultRouter()
router.register('housetypes', HouseTypeViewSet)
router.register('agents', AgentViewSet)
router.register('estates', EstateViewSet)
router.register('tags', TagViewSet)
router.register('houseinfos', HouseInfoViewSet)
router.register('users', UserViewSet)

urlpatterns += router.urls
